<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html">
    <h:form id="addIndicativeProductPrice">
        <h:outputText style="font-weight: bold" value="Choose a business type:" />
        <h:selectOneRadio id="BusinessType" value="#{quotationBean.businessType}" required ="true">
            <f:selectItem id="Type1" itemLabel="Wholesales" itemValue="Wholesales" />
            <f:selectItem id="Type2" itemLabel="Direct" itemValue="Direct" />
        </h:selectOneRadio>
        <br/>
        <h:outputText style="font-weight: bold" value="Name of Product: " />
        <h:inputText required="true" requiredMessage="Field is required." id="nameOfProduct" value="#{quotationBean.productName}">
        </h:inputText>
        <br/>
        <h:outputText style="font-weight: bold" value="Price of Product: " />
        <h:inputText required="true" requiredMessage="Field is required." id="priceOfProduct" value="#{quotationBean.productPrice}">
        </h:inputText>
        <br/><br/>
        <br/><br/>
        <h:outputText style="font-weight: bold" value="Indicative Product Price Table" />
        <h:dataTable cellpadding="6px" cellspacing="24px" styleClass="allaroundborder" headerClass="allaroundborder" columnClasses="allaroundborder"
                     rowClasses="allaroundborder" value="#{quotationBean.productsList}" var="p">

            <h:column>
                <f:facet name="header">
                    <h:outputText value="Id" />
                </f:facet>
                <h:outputText value="#{p.id}" />
            </h:column>

            <h:column>
                <f:facet name="header">
                    <h:outputText value="Product Name" />
                </f:facet>
                <h:outputText value="#{p.productName}" />
            </h:column>

            <h:column>
                <f:facet name="header">
                    <h:outputText value="Business Type" />
                </f:facet>
                <h:outputText value="#{p.businessType}" />
            </h:column>

            <h:column>
                <f:facet name="header">
                    <h:outputText value="Product Price" />
                </f:facet>
                <h:outputText value="#{p.price}" />
            </h:column>
        </h:dataTable>

        <h:commandButton action="index.xhtml" value="Cancel"/>
        <br/> <br/>
        <h:commandButton action="result.xhtml" value="Add" actionListener="#{quotationBean.addIndicativeProductPrice}"/>
    </h:form>
</ui:composition>
